﻿using D3StatsClient.Commands;
using D3StatsClient.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;

namespace D3StatsClient.ViewModel
{
    public class SettingsWindowsViewModel : ViewModelBase
    {
        public ICommand SaveSettingsCommand { get; set; }
        public ICommand BrowseForSoundFileCommand { get; set; }
        public ICommand ChangeThemeCommand { get; set; }

        public SettingsWindowsViewModel()
        {
            SaveSettingsCommand = new SaveSettings();
            BrowseForSoundFileCommand = new BrowseForSoundFile();
            ChangeThemeCommand = new ChangeTheme();

            //Make sure we load the right values from settings
            Properties.Settings.Default.Reload();

            //Set properties
            this.NotifyOnLegendary = Properties.Settings.Default.PlayOnLegendary;
            this.NotifyOnRare = Properties.Settings.Default.PlayOnRare;
            this.NotifyOnMagic = Properties.Settings.Default.PlayOnMagic;
            this.LegendarySoundFile = Properties.Settings.Default.LegendarySoundFile;
            this.RareSoundFile = Properties.Settings.Default.RareSoundFile;
            this.MagicSoundFile = Properties.Settings.Default.MagicSoundFile;
            this.NotifyOnCrafting = Properties.Settings.Default.PlayOnCrafting;  
            this.CraftingSoundFile = Properties.Settings.Default.CraftingSoundFile;
            this.EnableMultiProcessSupport = Properties.Settings.Default.EnableMultiProcessSupport;
            this.SecurityToken = Properties.Settings.Default.UserSecurityToken.ToString();
            this.TrackerServiceProviderName = Properties.Settings.Default.TrackerServiceProviderName;
            this.IgnoreList = Properties.Settings.Default.IgnoreList;
            
        }

        public string IgnoreList
        {
            get { return (string)GetValue(IgnoreListProperty); }
            set { SetValue(IgnoreListProperty, value); }
        }

        // Using a DependencyProperty as the backing store for IgnoreList.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty IgnoreListProperty =
            DependencyProperty.Register("IgnoreList", typeof(string), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.IgnoreList));
        

        public string TrackerServiceProviderName
        {
            get { return (string)GetValue(TrackerServiceProviderNameProperty); }
            set { SetValue(TrackerServiceProviderNameProperty, value); }
        }

        // Using a DependencyProperty as the backing store for SecurityToken.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty TrackerServiceProviderNameProperty =
            DependencyProperty.Register("TrackerServiceProviderName", typeof(string), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.TrackerServiceProviderName));  

        public string SecurityToken
        {
            get { return (string)GetValue(SecurityTokenProperty); }
            set { SetValue(SecurityTokenProperty, value); }
        }

        // Using a DependencyProperty as the backing store for SecurityToken.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty SecurityTokenProperty =
            DependencyProperty.Register("SecurityToken", typeof(string), typeof(SettingsWindowsViewModel), new PropertyMetadata(string.Empty));  

        public bool EnableMultiProcessSupport
        {
            get { return (bool)GetValue(EnableMultiProcessSupportProperty); }
            set { SetValue(EnableMultiProcessSupportProperty, value); }
        }

        // Using a DependencyProperty as the backing store for EnableMultiProcessSupport.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty EnableMultiProcessSupportProperty =
            DependencyProperty.Register("EnableMultiProcessSupport", typeof(bool), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.EnableMultiProcessSupport));      

        public string Status
        {
            get { return (string)GetValue(StatusProperty); }
            set { SetValue(StatusProperty, value); }
        }

        // Using a DependencyProperty as the backing store for Status.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty StatusProperty =
            DependencyProperty.Register("Status", typeof(string), typeof(SettingsWindowsViewModel), new PropertyMetadata(string.Empty));


        public string CraftingSoundFile
        {
            get { return (string)GetValue(CraftingSoundFileProperty); }
            set { SetValue(CraftingSoundFileProperty, value); }
        }

        // Using a DependencyProperty as the backing store for CraftingSoundFile.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty CraftingSoundFileProperty =
            DependencyProperty.Register("CraftingSoundFile", typeof(string), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.CraftingSoundFile));
     

        public bool NotifyOnCrafting
        {
            get { return (bool)GetValue(NotifyOnCraftingProperty); }
            set { SetValue(NotifyOnCraftingProperty, value); }
        }

        // Using a DependencyProperty as the backing store for NotifyOnCrafting.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty NotifyOnCraftingProperty =
            DependencyProperty.Register("NotifyOnCrafting", typeof(bool), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.PlayOnCrafting));

        
        public bool NotifyOnLegendary
        {
            get { return (bool)GetValue(NotifyOnLegendaryProperty); }
            set { SetValue(NotifyOnLegendaryProperty, value); }
        }

        // Using a DependencyProperty as the backing store for NotifyOnLegendary.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty NotifyOnLegendaryProperty =
            DependencyProperty.Register("NotifyOnLegendary", typeof(bool), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.PlayOnLegendary));


        public string LegendarySoundFile
        {
            get { return (string)GetValue(LegendarySoundFileProperty); }
            set { SetValue(LegendarySoundFileProperty, value); }
        }

        // Using a DependencyProperty as the backing store for LegendarySoundFile.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty LegendarySoundFileProperty =
            DependencyProperty.Register("LegendarySoundFile", typeof(string), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.LegendarySoundFile));


        public string RareSoundFile
        {
            get { return (string)GetValue(RareSoundFileProperty); }
            set { SetValue(RareSoundFileProperty, value); }
        }

        // Using a DependencyProperty as the backing store for RareSoundFile.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty RareSoundFileProperty =
            DependencyProperty.Register("RareSoundFile", typeof(string), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.RareSoundFile));
      

        public bool NotifyOnRare
        {
            get { return (bool)GetValue(NotifyOnRareProperty); }
            set { SetValue(NotifyOnRareProperty, value); }
        }

        // Using a DependencyProperty as the backing store for NotifyOnRare.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty NotifyOnRareProperty =
            DependencyProperty.Register("NotifyOnRare", typeof(bool), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.PlayOnRare));


        public bool NotifyOnMagic
        {
            get { return (bool)GetValue(NotifyOnMagicProperty); }
            set { SetValue(NotifyOnMagicProperty, value); }
        }

        // Using a DependencyProperty as the backing store for NotifyOnMagic.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty NotifyOnMagicProperty =
            DependencyProperty.Register("NotifyOnMagic", typeof(bool), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.PlayOnMagic));

        public string MagicSoundFile
        {
            get { return (string)GetValue(MagicSoundFileProperty); }
            set { SetValue(MagicSoundFileProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MagicSoundFile.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty MagicSoundFileProperty =
            DependencyProperty.Register("MagicSoundFile", typeof(string), typeof(SettingsWindowsViewModel), new PropertyMetadata(Properties.Settings.Default.MagicSoundFile)); 

    }
}
